$(function () {
    $('#captcha-img').click(function (event) {
       var self = $(this);
       var src = self.attr('src');
        var newsrc = zlparam.setParam(src,'xx',Math.random());
        self.attr('src',newsrc);
    });
});
$(function () {
   $('#submit_signin').click(function (event) {
       event.preventDefault();

       var emailE = $('input[name="email"]');
       var passwordE = $('input[name="password"]');
       var rememberPswE = $('input[name="rememberPsw"]');
      var graph_captchaE = $('input[name="graph_captcha"]');

       var email = emailE.val();
       var password = passwordE.val();
       var rememberPsw = rememberPswE.checked?1:0;
       var graph_captcha = graph_captchaE.val();

       zlajax.post({
           'url' : '/signin/' ,
           'data' : {
               'email' : email ,
               'password' : password,
               'rememberPsw' : rememberPsw,
               'graph_captcha' : graph_captcha
           },
           'success' : function (data) {
               if (data['code'] == 200){
                   var return_to = $('#return-to-span').text();
                   if (return_to){
                       window.location = return_to;
                   }else {
                       window.location = '/';
                   }
               }else {
                   passwordE.val('');
                   graph_captchaE.val('');
                   xtalert.alertInfo(data['message']);
               }
           },
           'fail' : function (error) {

               xtalert.alertNetworkError('网络错误！');

           }
       })

   }) ;
});